package com.wangxinrou.wangxinrou_surprisemeal.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangxinrou.wangxinrou_surprisemeal.model.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    // 通过邮箱确定用户是否存在
    @Select("SELECT COUNT(*) FROM user WHERE email = #{email}")
    int countUserByEmail(String email);

    @Select("SELECT * FROM user WHERE name = #{name}")
    User selectByName(String name);

    @Delete("DELETE FROM user WHERE name = #{name}")
    void deleteByName(String name);
}